<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //数组的every 和 some 方法
    //这两个方法，都是根据条件。得出一个布尔结果

    //every 要求每一个元素都符合条件，最终结果才是true，否则是false
    //some 要求有一些元素符合条件，最终结果是true，否则是false

    let arr = [2,3,4,5,6,7]
    let res = arr.every(item => {
      // return '条件'
      return item > 3
    })
    console.log(res);

    let arr1 = [2,3,4,5,6,7]
    let res1 = arr1.some(item => {
      // return '条件'
      return item > 3
    })
    console.log(res);

    let list = [
      {id:2, name:'zs', aa:true},
      {id:4, name:'zf', aa:true},
      {id:6, name:'sd', aa:true},
      {id:9, name:'wl', aa:true},
    ]

    let re = list.every(item => {
      //return '条件'
      // return item.aa == true
      return item.aa
    })
    console.log(re);

    //关于条件 参照对比  flag == true  写成flag即可
    let flag = true
    if(flag){
      console.log(11);
    }else{
      console.log(22);
    }
  </script>
</body>
</html>